<script>
$(document).ready(function(){
    $(".display_cart").hide();

    $("a.new").on('click',function(){
        $("div#chiudi").show()
        var daod = $(this).attr("dao")
        $("div#searchBox").hide()
        $("div#filterbox").hide()
        $("div#preview").hide()
        $("div#nav").hide()
        $("div#daoaddedit").show()
        $('div#daoaddedit').load('../../daoadd',{"dao":daod })
    });

    $('.infopeso').on('click', function(event) {
        //$("div#chiudi").show()
        $("div#searchBox").hide()
        $("div#filterbox").hide()
        //$("div#preview").hide();
        $("div#daoaddedit").show();
        var id_cliente = $(this).attr("id_cliente");
        var daos = $(this).attr("dao");
        $('div#daoaddedit').load('/anagrafiche/cliente/infopeso',{ 'idr':id_cliente,"dao":daos });
        });

    $(".edit").on("click", function() {
        $("div#searchBox").hide();
        $("div#chiudi").show();
        $("div#filterbox").hide();
        $("div#preview").hide();
        $("div#daoaddedit").show();
        $("div#riepilogo").hide();
        var id_cliente = $(this).attr("id_cliente");
        var daos = $(this).attr("daoCliente");
        $('div#daoaddedit').load('/anagrafiche/cliente/edit',{ 'idr':id_cliente,"dao":daos })
        });

  });
</script>
<a href="#" class="new" dao='cliente'><button type="button" style="margin:10px;width:670px;">NUOVO CLIENTE</button></a>


<table cellpadding="3" cellspacing="1" border="0" class="lista_clienti">
<tr>
    <td class="even-detail">Cognome Nome</td>
    <td class="even-detail" width="150">Data Inizio</td>
    <td class="even-detail" width="150">Telefono</td>
    <td class="even-detail" width="50">Modifica</td>
</tr>
{% for a in pageData['daos'] %}
<tr>
    <td align="left"><a href="#" class="infopeso" dao="cliente" id_cliente="{{a.id}}" /> {{a.ragione_sociale|upper}}</a></td>
    {% if a.tip %}
    <td align="left">{{a.tip[0].data_inizio|dateformat}}&nbsp;</td>
    {% else %}
    <td align="left">&nbsp;</td>
    {% endif %}
    <td align="left">{{a.cellulare_principale|nonone}}&nbsp;</td>
    <td align="left"><a class="edit" href="#" dao="{{pageData['_dao_']}}" id_cliente="{{a.id}}"><img src="/templates/giustopeso/img/edit_profile.png" width="25" height="25" align="absmiddle" alt="" border="0"></a></td>
</tr>
{% endfor %}
</table>
